package com.woniu.smart.security;

import com.woniu.smart.entity.SysAdmin;
import com.woniu.smart.entity.SysPermission;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

/**
 * @Description: TODO
 * @Author: WangHeng
 * @Date: 2022/10/24 18:24
 */
@Data
public class LoginUser implements UserDetails {
    private SysAdmin sysAdmin;
    private List<SysPermission> sysPermissions;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return sysAdmin.getEmpPawd();
    }

    @Override
    public String getUsername() {
        return sysAdmin.getEmpTel();
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
